<?php if (!defined('SERVER_ROOT')) { exit('No direct script access allowed');}
$this->template->title = 'Cập nhật công tác cán bộ';
$v_pop_win = isset($_REQUEST['pop_win']) ? '_pop_win' : '';
$this->template->display('dsp_header' . $v_pop_win . '.php');

$MA_CAN_BO ='';
$MA_TO_CHUYEN_MON ='';
$MA_CHUC_VU ='';
$TEN_DON_VI ='';
$TEN_TO_CHUYEN_MON='';
$TEN_CHUC_VU='';
$KIEM_NHIEM='';
$TU_NGAY='';
$DEN_NGAY='';
while ($arr = $arr_thuoc_to_detail->FetchRow()){
    $MA_CAN_BO = $arr['MA_CAN_BO'];
    $MA_TO_CHUYEN_MON =$arr['MA_TO_CHUYEN_MON'];
    $MA_CHUC_VU =$arr['MA_CHUC_VU'];
    $TEN_DON_VI =$arr['TEN_DON_VI'];
    $TEN_TO_CHUYEN_MON=$arr['TEN_TO_CHUYEN_MON'];
    $TEN_CHUC_VU=$arr['TEN_CHUC_VU'];
    $KIEM_NHIEM=$arr['KIEM_NHIEM'];
    $TU_NGAY=$arr['TU_NGAY2'];
    $DEN_NGAY=$arr['DEN_NGAY2'];
}
?>

<form name="frmMain_phanto" method="post" id="frmMain_phanto" action=""><?php
    echo $this->hidden('controller', $this->get_controller_url());
    echo $this->hidden('hdn_dsp_single_method', 'dsp_single_to');
    echo $this->hidden('hdn_dsp_all_method', 'dsp_single_to');
    echo $this->hidden('hdn_update_method', 'update_phanto');
    echo $this->hidden('hdn_delete_method', 'delete_phanto');
    echo $this->hidden('hdn_item_id', $MA_CAN_BO);
    echo $this->hidden('hdn_item_id_canbo', $MA_CAN_BO);
    echo $this->hidden('hdn_item_id_to', $MA_TO_CHUYEN_MON);
    echo $this->hidden('hdn_item_id_chucvu', $MA_CHUC_VU);
    echo $this->hidden('hdn_item_id_tungay', $TU_NGAY);
    echo $this->hidden('pop_win', $v_pop_win);
    ?>
    <h4 style="text-align: center; ">Cập nhật công tác cán bộ </h4>
    <div class="Row">
        <div class="left-Col">Đơn vị: </div>
        <div class="right-Col">
            <?php echo $TEN_DON_VI; ?>
        </div>
    </div>
    <div class="Row" id="div_cbx_tochuyenmon">
        <div class="left-Col">Tổ/bộ môn: </div>
        <div class="right-Col">
            <?php echo $TEN_TO_CHUYEN_MON; ?>
        </div>
    </div>

    <div class="Row">
        <div class="left-Col">Chức vụ: </div>
        <div class="right-Col">
            <?php echo $TEN_CHUC_VU; ?>
        </div>
    </div>
    <div class="Row">
        <div class="left-Col">Kiêm nhiệm: </div>
        <div class="right-Col">
            <input type="checkbox" name="chkkiemnhiem"<?php if ($KIEM_NHIEM ==1): ?>checked="checked" <?php endif?>   />
        </div>
    </div>
    <div class="Row">
        <div class="left-Col">Từ ngày: </div>
        <div class="right-Col">
            <?php echo $TU_NGAY; ?>
        </div>
    </div>
    <div class="Row">
        <div class="left-Col">Đến ngày: </div>
        <div class="right-Col">
            <?php if ($DEN_NGAY ==''): ?>
            <input type="text" id="txt_end_date" name="txt_end_date"
            class="inputbox" data-validate="date"
            data-name="ngày bắt đầu"  value="<?php echo $DEN_NGAY; ?>"  />
            <img class="btndate" style="cursor:pointer" id="btnDate" src="<?php echo SITE_ROOT; ?>public/images/calendar.gif" onclick="DoCal('txt_end_date')">
            <?php else:?>
            <?php echo $DEN_NGAY; ?>
            <?php endif?>
        </div>
    </div>
<div class="button-area">
    <input type="button" name="update" class = 'button' value="Cập nhật" onclick="update_thuocto();"/>
    <?php $v_back_action = ($v_pop_win === '') ? 'btn_back_onclick();' : 'try{window.parent.hidePopWin();}catch(e){window.close();};'; ?>
    <input type="button" name="cancel" class = 'button' value="Bỏ qua" onclick="<?php echo $v_back_action; ?>"/>
</div>
</form>
<script>
    function get_to_by_donvi(madonvi){
              $.ajax({url: "<?php echo SITE_ROOT; ?>qlcb/canbo/dsp_cbx_tochuyenmon/" + madonvi, success: function(result) {
                $("#div_cbx_tochuyenmon").html(result);
            }
        });
    }
    function update_thuocto() {
        var f = document.frmMain_phanto;
        m = $("#controller").val() + 'update_thuocto/0/';
        var xObj = new DynamicFormHelper('', '', f);
        if (xObj.ValidateForm(f)) {
            $("#frmMain_phanto").attr("action", m);
            f.submit();
        }
    }
</script>
<?php $this->template->display('dsp_footer' . $v_pop_win . '.php');